package com.moli.iov.admin.model.vo.req;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

/**
 * <p>
 *
 * </p>
 *
 * @author zql
 * @since 2019/9/9 14:54
 */
@Data
public class UserVo extends BaseVo {


  /**
   * 主键
   */
  @NotNull(message = "用户id不能为空", groups = {Update.class, Reset.class})
  private Long userId;

  /**
   * 用户名
   */
  @NotEmpty(message = "用户名不能为空", groups = {Login.class})
  private String account;

  /**
   * 密码
   */
  @NotEmpty(message = "密码不能为空", groups = {Login.class})
  private String password;

  /**
   * 邮箱
   */
  @NotEmpty(message = "邮箱不能为空", groups = {Save.class})
  @Email(message = "邮箱格式错误", groups = {Save.class})
  @Length(max = 100, message = "邮箱最大长度为100", groups = {Save.class})
  private String email;

  /**
   * 手机号
   */
  @NotEmpty(message = "手机号码不能为空", groups = {Save.class, Update.class})
  @Pattern(regexp = "^[1-9]\\d*|0$", message = "手机号码只能为数字", groups = {Save.class, Update.class})
  @Length(max = 20, message = "手机号码最大长度为20", groups = {Save.class, Update.class})
  private String userPhone;

  /**
   * 真实姓名
   */
  @NotEmpty(message = "真实姓名不能为空", groups = {Save.class, Update.class})
  @Length(min = 2, max = 10, message = "真实姓名2至10个字符", groups = {Save.class, Update.class})
  private String realName;

  /**
   * 企业id
   */
  private Long companyId;

  /**
   * 企业名称
   */
  private String companyName;

  /**
   * 账号状态：1、启用 0、禁用
   */
  @NotNull(message = "账号状态不能为空", groups = {Save.class, Update.class})
  private Integer status;

  /**
   * 角色Id
   */

  @NotNull(message = "角色不能为空", groups = {Save.class, Update.class})
  private Long roleId;

  /**
   * 原密码
   */
  @NotEmpty(message = "原密码不能为空", groups = {UpdatePwd.class})
  private String oldPassword;

  /**
   * 新密码
   */
  @NotEmpty(message = "新密码不能为空", groups = {UpdatePwd.class})
  private String newPassword;

  /**
   * 用户类型
   */
  private Integer userType;

  public interface Save{}

  public interface Update{}

  public interface Reset{}

  public interface UpdatePwd{}

  public interface Login{}
}

